const { Sequelize, DataTypes } = require('sequelize');
const config = require('../config/config.js');
const sequelize = new Sequelize(config);

let columnModel = sequelize.define(
	'column',
	{
		// 在这里定义模型属性
		name: {
			type: DataTypes.STRING,
			comment: '栏目名称'
		},
		link: {
			type: DataTypes.STRING,
			comment: '链接'
		},
		keyword: {
			type: DataTypes.STRING,
			comment: '关键词'
		},
		description: {
			type: DataTypes.STRING,
			comment: '描述'
		},
		created_time: {
			type: Sequelize.INTEGER,
			comment: '注册时间',
			defaultValue: Date.parse(new Date()) / 1000
		},
		updated_time: {
			type: Sequelize.INTEGER,
			comment: '更新时间',
			defaultValue: Date.parse(new Date()) / 1000
		}
	},
	{
		// 这是其他模型参数
		timestamps: false,
		tableName: 'column'
	}
);

module.exports = columnModel;
